<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: easyui-header('定时任务日志列表')" />
</head>
<body class="gray-bg">

	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-head">
				<div class="easyui-panel">
					<form id="jobLog-form">
						<div class="select-list">
							<ul>
								<li>
									<label>任务名称：</label>
									<input id="jobName" type="text" name="jobName" th:value="${job!=null?job.jobName:''}" class="easyui-textbox" data-options="prompt:'请输入任务名称'"/>
								</li>
								<li>
									<label>任务分组：</label>
									<select name="jobGroup" class="easyui-combobox" th:with="type=${@dict.getType('sys_job_group')}">
										<option value=" ">所有</option>
										<th:block th:if="${job==null}"><option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option></th:block>
										<th:block th:if="${job!=null}"><option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{job.jobGroup}"></option></th:block>
									</select>
								</li>
								<li>
									<label>执行状态： </label>
									<select name="status" class="easyui-combobox" th:with="type=${@dict.getType('sys_common_status')}">
										<option value=" ">所有</option>
										<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
									</select>
								</li>
								<li>
									<label>执行时间： </label>
									<input type="text" id="startTime" class="easyui-datebox" style="width: 110px;" data-options="prompt:'开始时间'" name="params[beginTime]"/>
									<span>-</span>
									<input type="text" id="endTime" class="easyui-datebox" style="width: 110px;" data-options="prompt:'结束时间'" name="params[endTime]"/>
								</li>
								<li>
									<a class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="$.easyUIDataGrid.search()" >查询</a>
									<a class="easyui-linkbutton" data-options="iconCls:'icon-clear'" onclick="$.easyUIDataGrid.reset()" >重置</a>
								</li>
							</ul>
						</div>
					</form>
				</div>
			</div>
			<div class="col-sm-12 search-body">
			     <div id="toolbar" role="group">
		            <a class="easyui-linkbutton" data-options="iconCls:'icon-delete'" onclick="$.easyUIOperate.removeAll()" shiro:hasPermission="monitor:job:remove">删除</a>
		            <a class="easyui-linkbutton" data-options="iconCls:'icon-export'" onclick="$.easyUIOperate.exportExcel()" shiro:hasPermission="monitor:job:export">导出</a>
		            <a class="easyui-linkbutton" data-options="iconCls:'icon-extjs-cancel'" onclick="$.easyUIOperate.clean()" shiro:hasPermission="monitor:job:remove">清空</a>
		        </div>
			    <table id="dg" class="easyui-datagrid"></table>
			</div>
		</div>
	</div>
	<th:block th:include="include :: easyui-footer" />
 	<script th:inline="javascript">
	 	var detailFlag = [[${@permission.hasPermi('monitor:job:detail')}]];
		var statusDatas = [[${@dict.getType('sys_common_status')}]];
		var groupDatas = [[${@dict.getType('sys_job_group')}]];
    </script>
	<script th:inline="none">
		var prefix = ctx + "monitor/jobLog";
		$(function() {
		    var options = {
		        url: prefix + "/list",
		        cleanUrl: prefix + "/clean",
		        detailUrl: prefix + "/detail/{id}",
		        removeUrl: prefix + "/remove",
		        exportUrl: prefix + "/export",
		        queryParams: {
					"jobName" : $("#jobName").textbox("getValue")
				},
		        modalName: "调度日志",
		        idField: 'jobLogId',
		        sortName: "createTime",
		        sortOrder: "desc",
		        columns: [[
					{
						field:'ck',
						checkbox:true,
						width:30
					},
			        {
			            field: 'jobLogId',
			            title: '日志编号',
		            	align: 'center',
		            	hidden:true
			        },
			        {
			            field: 'jobName',
			            title: '任务名称',
			            align: 'center',
			            width: 80
			        },
			        {
			            field: 'jobGroup',
			            title: '任务分组',
			            align: 'center',
			            width: 60,
			            formatter: function(value, row, index) {
			            	return $.table.selectDictLabel(groupDatas, value);
			            }
			        },
			        {
			            field: 'invokeTarget',
			            title: '调用目标字符串',
			            align: 'center',
		          		width: 80
			        },
			        {
			            field: 'jobMessage',
			            title: '日志信息',
			            align: 'center',
		          		width: 120
			        },
			        {
			            field: 'status',
			            title: '状态',
			            align: 'center',
			            width: 60,
			            formatter: function(value, row, index) {
			            	return $.table.selectDictLabel(statusDatas, value);
			            }
			        },
			        {
			            field: 'createTime',
			            title: '创建时间',
			            sortable: true,
			            align: 'center',
		          		width: 100
			        },
			        {
			        	field:'action',
			            title: '操作',
			            align: 'center',
			            width: 100,
			            formatter: function(value, row, index) {
			                var actions = [];
			                actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.easyUIOperate.detail(\'' + row.jobLogId + '\',\'600\',\'450\')"><i class="fa fa-search"></i>详细</a>');
			                return actions.join('');
			            }
		        	}
		        ]]
		    };
		    $.easyUIDataGrid.init(options);
		});
	</script>
</body>
</html>